package field

import "gitee.com/yanwc/net/utils"

type (
	LocationTimestamp    uint32
	LocationTimestampRaw [4]byte // 定位时间戳 单位:  [4]byte // 定位时间戳 单位: s
)

func (lt LocationTimestamp) Raw() (out LocationTimestampRaw) {
	copy(out[:], utils.NumberToBytesWithBigEndian(lt))
	return
}

func (lt LocationTimestampRaw) Type() LocationTimestamp {
	return utils.BytesToNumber[LocationTimestamp](lt[:])
}

func (lt LocationTimestamp) Unix() int64 {
	return int64(lt)
}

func (lt LocationTimestampRaw) Slice() []byte {
	return lt[:]
}
